package tests.org.nicta.learn.factorization.PMF;

import static org.junit.Assert.*;

import java.util.HashMap;

import org.junit.Before;
import org.junit.Test;
import org.nicta.datasetLoader.LinkR.LinkRArffLoader;
import org.nicta.learn.factorization.PMF.PMF;
import org.nicta.learn.factorization.naiveFactorization.NaiveMF;

public class pmfTest {

	PMF mf;
	LinkRArffLoader loader;
	@Before 
	public void initialize()throws Exception{
		
	}
	
	@Test
	public void testnaiveFactorization() throws Exception{
		for(int i = 1; i<11 ; i++){
			String pathTrain = "/home/ssedhain/Documents/social-recommendation/social-recommendation/anicham/pages_binary/active_page_membership_binary_data.arff.train."+i;
			String pathTest = "/home/ssedhain/Documents/social-recommendation/social-recommendation/anicham/pages_binary/active_page_membership_binary_data.arff.test."+i;

			loader = new LinkRArffLoader(pathTrain, pathTest);
			mf = new PMF(5, loader.getTrainRatings(), loader.getUserCount(), loader.getItemCount());
			mf.factorize();
			System.out.println(mf.calculateTestError(loader.getTestRatings())[0]);
		}
	}

}
